package com.hengda.museumonline.ui;


import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.WindowManager;
import android.widget.Toast;

import com.hengda.museumonline.rxbus.RxBus;
import com.hengda.museumonline.utils.SharedPreferenceUtil;
import com.hengda.museumonline.utils.ThemeChangeUtil;
import com.hengda.museumonline.utils.UinfoUtil;

import rx.Observable;
import rx.functions.Action1;

/**
 * @author：JFWU on 2016/9/10 14:09
 * @E-mail：jeffy12138@126.com
 */
public class BaseActivity extends AppCompatActivity {
    public ProgressDialog dialog;
    public SharedPreferenceUtil spUtil;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ThemeChangeUtil.changeTheme(this);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        }
        dialog = new ProgressDialog(this);
        dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        spUtil = new SharedPreferenceUtil(this, "com.hengda.museumonline");
    }

    public void startActivity(Context context, Class c) {
        Intent intent = new Intent(context, c);
        startActivity(intent);
    }

    public void startActivity(Context context, Class c, Bundle bundle) {
        Intent intent = new Intent(context, c);
        intent.putExtras(bundle);
        startActivity(intent);
    }

    public void getToast(String s) {
        Toast.makeText(BaseActivity.this, s, Toast.LENGTH_SHORT).show();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();

    }
}
